/**
 * @Author:  renyc
 * @Date: 2022年12月13日23:34:16
 */
'use strict';

import * as echarts from 'echarts';
import Widget from "../Widget";

/**
 * 图表Widget
 */
class ChartWidget extends Widget{

    constructor(container, options){
        super(container, options);

        this._delegate = this._container;
        this._echarts = echarts.init(this._container);

        this._xAxises = [];
        this._yAxises = [];
        this._series = [];
        this._dataZooms = [];
        this._tooltip = undefined;
    }

    dispose() {
        this._delegate = undefined;
        if(this._echarts){
            this._echarts.dispose();
        }
    }

    addSerie(serie){
        if(serie){
            this._series.push(serie);
            this._addSerie(serie);
        }
    }

    getSeries(){
        return this._series;
    }

    get xAxises(){
        return this._xAxises;
    }

    /**
     * @override
     */
    addXAxis(axis){}

    get yAxis(){
        return this._yAxises;
    }

    /**
     * @override
     * @param {} axis 
     */
    addYAxis(axis){}

    get dataZooms(){
        return this._dataZooms;
    }

    /**
     * @override
     * @param {} dataZoom 
     */
    addDataZoom(dataZoom){}

    get tooltip(){
        return this._tooltip;
    }

    /**
     * @override
     * @param {} tooltip 
     */
    setTooltip(tooltip){}

    /**
     * 内部函数：添加Series
     * @override
     * @param {} serie      
     */
    _addSerie(serie){}
}

export default ChartWidget
